package com.github.pig.admin.model.attendance;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.github.pig.common.util.DateTools;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author sxf
 * @since 2018-11-22
 */
@TableName("attendance_record")
public class AttendanceRecord extends Model<AttendanceRecord> {

    private static final long serialVersionUID = 1L;

    //早勤
    public static final String ATTEND_EARLY="0";
    //晚勤
    public static final String ATTEND_LATE ="1";

    //是否正常 0正常  2缺卡 3出差 4迟到 5早退 6外勤
    public static final String IS_NORMAL ="0";
    public static final String IS_NORMAL_MISSING ="2";
    public static final String IS_NORMAL_TRAVEL ="3";
    public static final String IS_NORMAL_LATE ="4";
    public static final String IS_NORMAL_LEAVE  ="5";


    private String id;
    @TableField("user_name")
    private String userName;
    @TableField("time_id")
    private String timeId;
    /**
     * 类型 0早勤1晚勤
     */
    @TableField("record_type")
    private String recordType;
    /**
     * 考勤地址
     */
    private String address;
    /**
     * 考勤经纬度
     */
    private String coordinate;
    /**
     * 考勤方式
     */
    @TableField("attendance_type")
    private String attendanceType;
    /**
     * 考勤范围ID 类型为wifi时  这里放wifi表Id
     */
    @TableField("add_id")
    private String addrId;

    /**
     * 打卡设备
     */
    private String imei;
    /**
     * 考勤时间
     */
    private Date time;
    /**
     * 是否正常 0正常  2缺卡 3出差 4迟到 5早退 6外勤 
     */
    @TableField("is_normal")
    private String isNormal;
    /**
     * 当天第几次打卡
     */
    private Integer times;
    @TableField("create_time")
    private Date createTime;
    @TableField("update_time")
    private Date updateTime;
    @TableField("del_flag")
    private String delFlag;

    @TableField(exist = false)
    private String date;


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getRecordType() {
        return recordType;
    }

    public void setRecordType(String recordType) {
        this.recordType = recordType;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCoordinate() {
        return coordinate;
    }

    public void setCoordinate(String coordinate) {
        this.coordinate = coordinate;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public String getIsNormal() {
        return isNormal;
    }

    public void setIsNormal(String isNormal) {
        this.isNormal = isNormal;
    }

    public Integer getTimes() {
        return times;
    }

    public void setTimes(Integer times) {
        this.times = times;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getAttendanceType() {
        return attendanceType;
    }

    public void setAttendanceType(String attendanceType) {
        this.attendanceType = attendanceType;
    }

    public String getAddrId() {
        return addrId;
    }

    public void setAddrId(String addrId) {
        this.addrId = addrId;
    }

    public String getTimeId() {
        return timeId;
    }

    public void setTimeId(String timeId) {
        this.timeId = timeId;
    }

    public String getImei() {
        return imei;
    }

    public void setImmei(String imei) {
        this.imei = imei;
    }

    public String getDate(){
        return DateTools.formatDate(this.time);
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "AttendanceRecord{" +
        ", id=" + id +
        ", recordType=" + recordType +
        ", address=" + address +
        ", coordinate=" + coordinate +
        ", time=" + time +
        ", isNormal=" + isNormal +
        ", times=" + times +
        ", createTime=" + createTime +
        ", updateTime=" + updateTime +
        "}";
    }
}
